package com.jiangore.extension.log;

/**
 * Todo
 *
 * @Author jiangtao
 * @CreateBy 2019-07-18 11:55 PM
 * @UpdateBy jiangtao
 * @Version v1.0
 */
public class SQLiteConnectionFactory {

    /*private static interface Singleton {
        final SQLiteConnectionFactory INSTANCE = new SQLiteConnectionFactory();
    }

    private final DataSource dataSource;


    private SQLiteConnectionFactory() {
        try {
            Class.forName("org.sqlite.JDBC");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            System.exit(0);
        }

        Properties properties = new Properties();
        properties.setProperty("user", "");
        properties.setProperty("password", "");

        GenericObjectPool<PoolableConnection> pool = new GenericObjectPool<PoolableConnection>();
        DriverManagerConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:sqlite:db/vms_error_log.db", properties);

        new PoolableConnectionFactory(connectionFactory, pool, null,"SELECT 1", 3, false, false, Connection.TRANSACTION_READ_UNCOMMITTED);

        this.dataSource = new PoolingDataSource(pool);
    }

    public static Connection getDatabaseConnection() throws SQLException {
        return Singleton.INSTANCE.dataSource.getConnection();
    }*/
}
